﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using NUnit.Framework;
using System.Net.DnsToolkit.Packet;
using System.Net.DnsToolkit.Resolver;
using System.Net.DnsToolkit.Packet.Busy;


namespace System.Net.DnsToolkit.TestUnit.Resolver {
    [TestFixture]
    public class ResolverTest {

        [Test]
        public void TestResolv1() {

            string expected = "0003010000010000000000000377777704646F6D6E02746C0000010001";

            IMessage request = new Message() {
                Header = new Header() {
                    Id = 3,
                    // flags
                    QueryType = QREnum.QUERY,
                    OpCode = OpCodeEnum.StandardQuery,
                    AuthoritativeAnswer = false,
                    Truncation = false,
                    RecursionDesired = true,
                    RecursionAvailable = false,
                    Reserved = false,
                    AnswerAuthenticated = false,
                    NotAuthenticatedAcceptable = false,
                    ResponseCode = RCodeEnum.NoError,
                    // counts
                    QuestionCount = 1,
                    ResourceCount = 0,
                    AnswerCount = 0,
                    AuthorityCount = 0,
                },
                Questions = new List<IQuestion>() {
                    new Question() {
                        QName = new DomainName() { Name = "www.domn.tl." },
                        QType = QTypeEnum.A,
                        QClass = QClassEnum.IN
                    }
                }
            };

            //DnsResolver.GetHostEntry(
            IPAddress resolver = IPAddress.Parse("192.168.168.81");
            //Message reply = DnsClient.SendAndReceive(request, resolver);


        }

        private static string[] resolvers = new [] {
            "192.168.168.81", // bind9
            "192.168.168.82", // djbdns
            "192.168.168.83", // pdnsd
            "192.168.168.84"  // powerdns
        };

        static IEnumerable<IPAddress> ListResolver {
            get {
                return resolvers.Select(s => { return IPAddress.Parse(s); });
            }
        }

    }
}
